package org.gui.similarityMeasureSelection;

import java.awt.Font;
import java.awt.GridLayout;
import java.util.ArrayList;

import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

public class NgramPanel extends JPanel{

		private static final long serialVersionUID = 1L;
		
		JCheckBox isNgramSelected;
		JLabel nGramLabelFrom;
		JLabel nGramLabelTo;
		JTextField nGramInputFrom;
		JTextField nGramInputTo;
		
	public NgramPanel(){

		setLayout(new GridLayout(1,4,0,10));
		isNgramSelected = new JCheckBox("n-gram");
		nGramLabelFrom = new JLabel("From= ");
		nGramLabelFrom.setHorizontalAlignment(JLabel.RIGHT);
		nGramInputFrom = new JTextField();
		nGramLabelTo = new JLabel("to= ");
		nGramLabelTo.setHorizontalAlignment(JLabel.RIGHT);
		nGramInputTo = new JTextField();
		Font font1 = new Font("SansSerif", Font.BOLD, 20);
	    nGramInputTo.setFont(font1);
		add(isNgramSelected);
		add(nGramLabelFrom);
		add(nGramInputFrom);
		add(nGramLabelTo);
		add(nGramInputTo);
	}
	
	public ArrayList<String> getSimilarityMeasure(){
		ArrayList<String> answer = new ArrayList<String>();
		if(isNgramSelected.isSelected()==true){
			answer.add(nGramInputFrom.getText());
			answer.add(nGramInputTo.getText());
			return answer;
		}	
		return null;
	}
}
